package com.gong.mapper.user;

import com.gong.pojo.User;
import com.gong.utils.MybatisUtil;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import java.util.List;

/**
 * @ClassName: UserMapper
 * @Description: TODO
 * @Author: 。。。
 * @Data: 2021/10/208:38
 * @Version: 1.0
 **/
public class UserMapperImpl implements UserMapper {
	public SqlSessionFactory sqlSessionFactory = MybatisUtil.getSqlSessionFactory();
	SqlSession sqlSession = sqlSessionFactory.openSession(true);
	UserMapper mapper = sqlSession.getMapper(UserMapper.class);

	public User getLoginUser(@Param("userCode") String userCode) {
		return mapper.getLoginUser(userCode);
	}

	@Override
	public int updateUserPassword(@Param("id") int id, @Param("userPassword") String password) {
		return mapper.updateUserPassword(id, password);
	}

	@Override
	public int getUserCount(@Param("userName") String userName, @Param("userRole") int userRole) {
		return mapper.getUserCount(userName, userRole);
	}

	@Override
	public List<User> getUserList(@Param("userName") String userName, @Param("userRole") int userRole, int currentPageNo, int pageSize) {
		return mapper.getUserList(userName, userRole, currentPageNo, pageSize);
	}


}
